﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
namespace MyWeb.Data
{
	public class tblOrderDAL : SqlDataProvider
	{

		#region[tblOrder_GetbyAll]
		public DataTable tblOrder_GetByAll()
		{
			using (var cmd = new SqlCommand("sp_tblOrder_GetByAll", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblOrder_GetbyId]
		public DataTable tblOrder_GetById(tblOrderInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblOrder_GetById", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_oid", Data._oid));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblOrder_GetbyTop]
		public DataTable tblOrder_GetByTop(string Top, string Where, string Order)
		{
			using (var cmd = new SqlCommand("sp_tblOrder_GetByTop", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				var da = new SqlDataAdapter(cmd);
				cmd.Parameters.Add(new SqlParameter("@Top",Top));
				cmd.Parameters.Add(new SqlParameter("@Where",Where));
				cmd.Parameters.Add(new SqlParameter("@Order",Order));
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblOrder_Getby_sid]
		public DataTable tblOrder_GetBy_sid(string _sid)
		{
			using (var cmd = new SqlCommand("sp_tblOrder_GetBy_sid", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_sid", _sid));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblOrder_Getby_uid]
		public DataTable tblOrder_GetBy_uid(string _uid)
		{
			using (var cmd = new SqlCommand("sp_tblOrder_GetBy_uid", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_uid", _uid));
				var da = new SqlDataAdapter(cmd);
				var dt = new DataTable();
				da.Fill(dt);
				return dt;
			}
		}
		#endregion
		#region[tblOrder_Insert]
		public void tblOrder_Insert(tblOrderInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblOrder_Insert", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_uid", Data._uid));
				cmd.Parameters.Add(new SqlParameter("@_sid", Data._sid));
				cmd.Parameters.Add(new SqlParameter("@_ocreatedate", Data._ocreatedate));
				cmd.Parameters.Add(new SqlParameter("@_ostatus", Data._ostatus));
				cmd.ExecuteNonQuery();
			}
		}
		#endregion
		#region[tblOrder_Update]
		public void tblOrder_Update(tblOrderInfo Data)
		{
			using (var cmd = new SqlCommand("sp_tblOrder_Update", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_uid", Data._uid));
				cmd.Parameters.Add(new SqlParameter("@_sid", Data._sid));
				cmd.Parameters.Add(new SqlParameter("@_oid", Data._oid));
				cmd.Parameters.Add(new SqlParameter("@_ocreatedate", Data._ocreatedate));
				cmd.Parameters.Add(new SqlParameter("@_ostatus", Data._ostatus));
				cmd.ExecuteNonQuery();
			}
		}
		#endregion
		#region[tblOrder_Delete]
		public void tblOrder_Delete(string Data)
		{
			using (var cmd = new SqlCommand("sp_tblOrder_Delete", GetConnection()))
			{
				cmd.CommandType = CommandType.StoredProcedure;
				cmd.Parameters.Add(new SqlParameter("@_oid", Data));
				cmd.ExecuteNonQuery();
			}
		}
		#endregion
	}
}